package com.xc.sys.framework.sitemesh;

import org.sitemesh.SiteMeshContext;
import org.sitemesh.content.ContentProperty;
import org.sitemesh.content.tagrules.TagRuleBundle;
import org.sitemesh.content.tagrules.html.ExportTagToContentRule;
import org.sitemesh.tagprocessor.State;

public class MyTagRuleBundle implements TagRuleBundle {
    @Override
    public void install(State state, ContentProperty contentProperty, SiteMeshContext siteMeshContext) {
        state.addRule("qj", new ExportTagToContentRule(siteMeshContext,contentProperty.getChild("qj"),false));
    }

    @Override
    public void cleanUp(State state, ContentProperty contentProperty, SiteMeshContext siteMeshContext) {
        if (!((ContentProperty)contentProperty.getChild("qj")).hasValue()) {
            ((ContentProperty)contentProperty.getChild("qj")).setValue(contentProperty.getValue());
        }
    }
}
